I am trying to interface DOORS with RTC using DXL. The method I have tried is using CURL to transfer the commands to RTC with batch files for each of the operations for PUT and GET. When using the system call System(cmdString) this works fine except I have no way of monitoring the DOS window for when it closes. I have tried using the win32SystemWait_ function which is OK for the GET statement but when using the PUT function, windows crashes out without any indication of the cause. Has anyone successfully interfaced with RTC work items using DOORS 9.5? any help would be appreciated.
|
Re: DOORS to RTC work item calls |
Re: DOORS to RTC work item calls SystemAdmin - Mon Mar 25 12:57:18 EDT 2013 Regards, Richard |
Re: DOORS to RTC work item calls
Instead of using Win32SystemWait_ you can use the shell com object. Here is some old library I did once. Maybe it helps, regards, Mathias
pragma runLim, 0
const string m_shell_handle = "handle"
const string m_shell_cmd = "cmd"
struct Shell {}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DxlObject DxlObjectOf(Shell p) { return (addr_ p) DxlObject }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void check_shell_res(string s) {
if (!null s) error "SHELL: executing command failed with following error - " s
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void delete(Shell p) {
DxlObject x = DxlObjectOf p;
delete x;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OleAutoObj ShellObject (Shell x) {
DxlObject obj = DxlObjectOf x
OleAutoObj result = (obj->m_shell_handle) OleAutoObj
return result
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// if getOutput is called, it will return only when the command has ended.
string getOutput (Shell x) {
OleAutoObj obj = ShellObject x
OleAutoObj stdout
OleAutoArgs args = create()
string result
check_shell_res oleGet(obj, "StdOut", stdout)
string printOut
check_shell_res oleMethod (stdout, "ReadAll", args, result)
delete args
return result
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int getIntProperty(Shell x, string name) {
OleAutoObj obj = ShellObject x
int result = 0
check_shell_res oleGet(obj, name, result )
return result
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Status 0 = running Status 1 = finished Status 2 = failed
int status (Shell x) { return getIntProperty(x, "Status") }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int exitCode (Shell x) { return getIntProperty(x, "ExitCode") }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int processID (Shell x) { return getIntProperty(x, "ProcessID") }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void terminate(Shell x) {
OleAutoObj obj = ShellObject x
check_shell_res oleMethod (obj, "Terminate")
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// if wait is true the script will wait for the process to end
Shell create(string cmd, bool wait) {
DxlObject x = new;
x->m_shell_cmd = ""
x->m_shell_handle = null OleAutoObj
OleAutoObj shellObj = oleCreateAutoObject "WScript.Shell"
OleAutoObj result = null
OleAutoArgs args = create()
put(args, cmd)
check_shell_res oleMethod(shellObj, "Exec", args, result)
while (true && wait) {
int status
check_shell_res oleGet(result, "Status", status)
if (status != 0) break
sleep_ 50
}
int intVar
string var
x->m_shell_cmd = cmd
x->m_shell_handle = result
return addr_ x
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void test () {
print "Starting NotePad"
Shell npad = create ("Notepad.exe", false)
print "Listing a directory ... don't close Nodepad!"
Shell cmd = create ("cmd.exe /C dir M:\\", true)
print "Output from cmd.exe:\n" getOutput cmd "\n"
sleep_ 1000
terminate npad
print "Nodepad Exit Code = " exitCode npad "\n"
print "Nodepad Status = " status npad "\n"
print "Doing something that will return an error:\n"
cmd = create ("cmd.exe /C copy 123", true)
print "Exit Code:" (exitCode cmd) "\n"
print "Status :" (status cmd) "\n"
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: DOORS to RTC work item calls Richard_Good - Mon Mar 25 14:30:42 EDT 2013 |
Re: DOORS to RTC work item calls Mathias Mamsch - Mon Mar 25 16:19:58 EDT 2013
Instead of using Win32SystemWait_ you can use the shell com object. Here is some old library I did once. Maybe it helps, regards, Mathias
pragma runLim, 0
const string m_shell_handle = "handle"
const string m_shell_cmd = "cmd"
struct Shell {}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DxlObject DxlObjectOf(Shell p) { return (addr_ p) DxlObject }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void check_shell_res(string s) {
if (!null s) error "SHELL: executing command failed with following error - " s
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void delete(Shell p) {
DxlObject x = DxlObjectOf p;
delete x;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OleAutoObj ShellObject (Shell x) {
DxlObject obj = DxlObjectOf x
OleAutoObj result = (obj->m_shell_handle) OleAutoObj
return result
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// if getOutput is called, it will return only when the command has ended.
string getOutput (Shell x) {
OleAutoObj obj = ShellObject x
OleAutoObj stdout
OleAutoArgs args = create()
string result
check_shell_res oleGet(obj, "StdOut", stdout)
string printOut
check_shell_res oleMethod (stdout, "ReadAll", args, result)
delete args
return result
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int getIntProperty(Shell x, string name) {
OleAutoObj obj = ShellObject x
int result = 0
check_shell_res oleGet(obj, name, result )
return result
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Status 0 = running Status 1 = finished Status 2 = failed
int status (Shell x) { return getIntProperty(x, "Status") }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int exitCode (Shell x) { return getIntProperty(x, "ExitCode") }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int processID (Shell x) { return getIntProperty(x, "ProcessID") }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void terminate(Shell x) {
OleAutoObj obj = ShellObject x
check_shell_res oleMethod (obj, "Terminate")
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// if wait is true the script will wait for the process to end
Shell create(string cmd, bool wait) {
DxlObject x = new;
x->m_shell_cmd = ""
x->m_shell_handle = null OleAutoObj
OleAutoObj shellObj = oleCreateAutoObject "WScript.Shell"
OleAutoObj result = null
OleAutoArgs args = create()
put(args, cmd)
check_shell_res oleMethod(shellObj, "Exec", args, result)
while (true && wait) {
int status
check_shell_res oleGet(result, "Status", status)
if (status != 0) break
sleep_ 50
}
int intVar
string var
x->m_shell_cmd = cmd
x->m_shell_handle = result
return addr_ x
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void test () {
print "Starting NotePad"
Shell npad = create ("Notepad.exe", false)
print "Listing a directory ... don't close Nodepad!"
Shell cmd = create ("cmd.exe /C dir M:\\", true)
print "Output from cmd.exe:\n" getOutput cmd "\n"
sleep_ 1000
terminate npad
print "Nodepad Exit Code = " exitCode npad "\n"
print "Nodepad Status = " status npad "\n"
print "Doing something that will return an error:\n"
cmd = create ("cmd.exe /C copy 123", true)
print "Exit Code:" (exitCode cmd) "\n"
print "Status :" (status cmd) "\n"
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: DOORS to RTC work item calls Mathias Mamsch - Mon Mar 25 16:19:58 EDT 2013
Instead of using Win32SystemWait_ you can use the shell com object. Here is some old library I did once. Maybe it helps, regards, Mathias
pragma runLim, 0
const string m_shell_handle = "handle"
const string m_shell_cmd = "cmd"
struct Shell {}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DxlObject DxlObjectOf(Shell p) { return (addr_ p) DxlObject }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void check_shell_res(string s) {
if (!null s) error "SHELL: executing command failed with following error - " s
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void delete(Shell p) {
DxlObject x = DxlObjectOf p;
delete x;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OleAutoObj ShellObject (Shell x) {
DxlObject obj = DxlObjectOf x
OleAutoObj result = (obj->m_shell_handle) OleAutoObj
return result
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// if getOutput is called, it will return only when the command has ended.
string getOutput (Shell x) {
OleAutoObj obj = ShellObject x
OleAutoObj stdout
OleAutoArgs args = create()
string result
check_shell_res oleGet(obj, "StdOut", stdout)
string printOut
check_shell_res oleMethod (stdout, "ReadAll", args, result)
delete args
return result
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int getIntProperty(Shell x, string name) {
OleAutoObj obj = ShellObject x
int result = 0
check_shell_res oleGet(obj, name, result )
return result
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Status 0 = running Status 1 = finished Status 2 = failed
int status (Shell x) { return getIntProperty(x, "Status") }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int exitCode (Shell x) { return getIntProperty(x, "ExitCode") }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int processID (Shell x) { return getIntProperty(x, "ProcessID") }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void terminate(Shell x) {
OleAutoObj obj = ShellObject x
check_shell_res oleMethod (obj, "Terminate")
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// if wait is true the script will wait for the process to end
Shell create(string cmd, bool wait) {
DxlObject x = new;
x->m_shell_cmd = ""
x->m_shell_handle = null OleAutoObj
OleAutoObj shellObj = oleCreateAutoObject "WScript.Shell"
OleAutoObj result = null
OleAutoArgs args = create()
put(args, cmd)
check_shell_res oleMethod(shellObj, "Exec", args, result)
while (true && wait) {
int status
check_shell_res oleGet(result, "Status", status)
if (status != 0) break
sleep_ 50
}
int intVar
string var
x->m_shell_cmd = cmd
x->m_shell_handle = result
return addr_ x
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void test () {
print "Starting NotePad"
Shell npad = create ("Notepad.exe", false)
print "Listing a directory ... don't close Nodepad!"
Shell cmd = create ("cmd.exe /C dir M:\\", true)
print "Output from cmd.exe:\n" getOutput cmd "\n"
sleep_ 1000
terminate npad
print "Nodepad Exit Code = " exitCode npad "\n"
print "Nodepad Status = " status npad "\n"
print "Doing something that will return an error:\n"
cmd = create ("cmd.exe /C copy 123", true)
print "Exit Code:" (exitCode cmd) "\n"
print "Status :" (status cmd) "\n"
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
I'm a little slow on the update here so don't be offended by these questions:
-Louie |
Re: DOORS to RTC work item calls llandale - Tue Mar 26 12:02:31 EDT 2013
-Louie
Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: DOORS to RTC work item calls Mathias Mamsch - Tue Mar 26 15:41:20 EDT 2013
Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS No, "system" returns as soon as the process is initiated which has forced me into a silly "wait for black window to close" ack following it; so I can display the results file of the command. -Louie |